import fetch from "@/utils/fetch"
import {formatDate1} from '@/utils/dateFomart.js'
export function getLinkTable(pagelist){
   console.log(pagelist);
    return fetch({
        url:'priFuncLink/page?pageNum='+pagelist.pageNum+"&pageSize="+pagelist.pageSize,
        method:'get',
        // data: pagelist
    })
}
export function getLinkTableserch(pagelist){
    console.log(pagelist);
     return fetch({
    url: '/priFuncLink/page/filter?pageNum='+pagelist.pageNum+'&pageSize='+pagelist.pageSize+'&name='+pagelist.name,
         method:'post',
         // data: pagelist
     })
 }
// export function addmatreialink(matreiadata){
//    console.log(matreiadata);
//     return fetch({
//         url:'priFuncLink',
//         method:'post',
//         data:JSON.stringify(matreiadata),
//     })
// }

export function addmatreialink(matreiadata){
   console.log(matreiadata);
    return fetch({
        url:'priFuncLink?name='+matreiadata.name+"&url="+matreiadata.url+"&createUserId="+matreiadata.createUserId+"&createTime="+matreiadata.createTime,
        method:'post'
    })
}
    
// export function editmatreialink(matreiadata){
//     console.log(matreiadata);
//      return fetch({
//          url:'priFuncLink',
//          method:'put',
//          data:JSON.stringify(matreiadata),
//      })
//  }

export function editmatreialink(matreiadata){
    var updateTime = formatDate1(new Date());
    
    console.log(matreiadata);
     return fetch({
         url:'priFuncLink?id='+matreiadata.id+"&name="+matreiadata.name+"&url="+matreiadata.url+"&updateUserId="+matreiadata.updateUserId+"&updateTime="+updateTime,
         method:'put',
     })
 }

 export function deletematreialink(id){
    console.log(id);
     return fetch({
         url:'priFuncLink/'+id,       
         method:'delete'
     })
 }



